#pragma once
#include "stdafx.h"
#include <TwOgreWindow.h>
#include <TwOgreWindowManager.h>
#include "Input.h"
#include "GUI.h"
class Simulation;

class ArtificialSea: public Ogre::FrameListener, public Ogre::WindowEventListener,
	public Ogre::Singleton<ArtificialSea>
{
public:
	ArtificialSea();
	virtual ~ArtificialSea();

	bool init(Ogre::String windowName);

	bool isShutDown() const { return shutDown; }
	void setShutDown(bool val) { shutDown = val; }

	Ogre::SceneManager* getSceneManager() { return sceneManager; }
	void setSceneManager(Ogre::SceneManager* val) { sceneManager = val; }

	CameraMan* getDiver() { return cameraMan; }

protected:
	//Ogre::FrameListener
	virtual bool frameRenderingQueued(const Ogre::FrameEvent& event);

	//Ogre::WindowEventListener
	virtual void windowResized(Ogre::RenderWindow* rw);
	virtual void windowClosed(Ogre::RenderWindow* rw);

	bool createRenderSystem();
	bool createRenderWindow(Ogre::String windowName);
	bool initializeResource();
	void createSceneManager();
	void createViewport();
	void createCamera();
	void initializeInput();
	void initializeGUI();
	bool createScene();
	void startRendering();

private:
	Ogre::Root* root;
	Ogre::RenderWindow* renderWindow;
	Ogre::Viewport* viewport;
	Ogre::SceneManager* sceneManager;
	Ogre::Camera* camera;
	Ogre::Log* log;

	Input* input;
	GUI* gui;
	CameraMan* cameraMan;

	bool shutDown;

	Simulation* simulation;
	Ogre::Real simTimeAccum;
	
};